package com.example.demo08;

import java.io.InputStream;

import android.os.Bundle;
import android.view.View;

public class ExecPage extends BaseTextPage {
	
	void get(String name) {
		try {
			append("getprop " + name + " = ");
			Process p = Runtime.getRuntime().exec("getprop " + name);
			InputStream is = p.getInputStream();
			
			byte[] buf = new byte[512];
			int n = is.read(buf);
			
			appendn(new String(buf, 0, n));
			
			update();
		} catch (Exception e) {
			e.printStackTrace();
		}
	}
	
	@Override
	public void onViewCreated(View view, Bundle savedInstanceState) {
		super.onViewCreated(view, savedInstanceState);
		
		
		get("ro.product.cpu.abi");
		get("ro.product.cpu.abi2");
		get("ro.serialno");
		get("ro.baseband");
		
//		try {
//			appendn("getprop ro.product.cpu.abi");
//			Process p = Runtime.getRuntime().exec("getprop ro.product.cpu.abi");
//			InputStream is = p.getInputStream();
//			
//			appendn("p=" + p.getClass());
//			appendn("is=" + is);
//			
//			byte[] buf = new byte[512];
//			int n = is.read(buf);
//			
//			appendn(new String(buf, 0, n));
//			
//			update();
//		} catch (Exception e) {
//			e.printStackTrace();
//		}
	}
}
